package com.ys.servers.points.dao.impl;

import com.ys.servers.common.dao.BasicNoSqlDao;
import com.ys.servers.points.dao.PointsTypeDao;
import com.ys.servers.points.data.PointsType;
import io.vertx.core.Future;

import java.util.List;

/**
 * Created by taotao on 2017/5/8.
 */
public class PointsTypeDaoImpl extends BasicNoSqlDao<PointsType> implements PointsTypeDao {

    @Override
    public Future<PointsType> savePointsType(PointsType pointsType) {
        return addData(pointsType);
    }

    @Override
    public Future<PointsType> restorePointsType(String id) {
        return restore(id, PointsType.class);
    }

    @Override
    public Future<Boolean> removePointsType(String id) {
        return deprecateData(id, PointsType.class);
    }

    @Override
    public Future<Boolean> purgePointsType(String id) {
        return this.deleteData(id, PointsType.class);
    }

    @Override
    public Future<PointsType> getPointsType(String id) {
        return this.getData(id, PointsType.class);
    }

    @Override
    public Future<Boolean> addPointsTypeToRedisList(PointsType pointsType) {
        return dataReader.addToRedisSortedList("AllPointsType", pointsType);
    }

    @Override
    public Future<Boolean> removePointsTypeFromRedisList(PointsType pointsType) {
        return dataReader.removeFromRedisSortedList("AllPointsType", pointsType);
    }

    @Override
    public Future<List<PointsType>> getAllPointsType() {
        return dataReader.getAllDataInSortedListWithScores("AllPointsType", 0, -1, PointsType.class);
    }
}
